import * as THREE from "three"
import { color } from "../config"
import vertexShader from "../shaders/radar/vertex.glsl"
import fragmentShader from "../shaders/radar/frag.glsl"
import { Mesh } from "three"
export class Radar {
    scene: THREE.Scene
    time
    constructor(scene: THREE.Scene, time: THREE.IUniform) {
        this.scene = scene
        this.time = time
        this.init()
    }
    init() {
        let radius = 50
        const plane = new THREE.PlaneGeometry(radius * 2, radius * 2, 1, 1)
        const material = new THREE.ShaderMaterial({
            fragmentShader,
            vertexShader,
            uniforms: {
                u_color: {
                    value: new THREE.Color(color.radarColor)
                },
                u_time: this.time
                ,
                u_radius: {
                    value: radius - 5
                }
            },
            side: THREE.DoubleSide,
            transparent: true
        })
        const mesh = new THREE.Mesh(plane, material)
        mesh.rotation.x = Math.PI / 2
        this.scene.add(mesh)
    }
}